﻿
/****** Object:  StoredProcedure [dbo].[DeleteAllViews]    Script Date: 09/16/2012 09:38:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Procedure [dbo].[DeleteAllViews]
As
      declare @viewName varchar(500)
      declare cur cursor 
            for select [name] from sys.objects where type = 'v'
      open cur
      fetch next from cur into @viewName
      while @@fetch_status = 0
      begin
            if @viewName <> 'DeleteAllViews'
                  exec('drop view ' + @viewName)
                  fetch next from cur into @viewName
      end
      close cur
      deallocate cur
GO
/****** Object:  StoredProcedure [dbo].[DeleteAllTables]    Script Date: 09/16/2012 09:38:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[DeleteAllTables]
As
      declare @viewName varchar(500)
      declare cur cursor 
            for select [name] from sys.objects where type = 'u'
      open cur
      fetch next from cur into @viewName
      while @@fetch_status = 0
      begin
            if @viewName <> 'DeleteAllTables'
                  exec('drop table ' + @viewName)
                  fetch next from cur into @viewName
      end
      close cur
      deallocate cur
GO
/****** Object:  StoredProcedure [dbo].[DeleteAllProcedures]    Script Date: 09/16/2012 09:38:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Procedure [dbo].[DeleteAllProcedures]
As
      declare @procName varchar(500)
      declare cur cursor 
            for select [name] from sys.objects where type = 'p'
      open cur
      fetch next from cur into @procName
      while @@fetch_status = 0
      begin
            if @procName <> 'DeleteAllProcedures'
                  exec('drop procedure ' + @procName)
                  fetch next from cur into @procName
      end
      close cur
      deallocate cur
GO
